package asteroids.model.programs.parsing.expressions;

import java.util.Map;

import asteroids.model.CollisionObject;
import asteroids.model.Ship;

public class Sin extends MathematicalExpression {
	public Sin(E e){
		super(e);
	}

	public Object getContent(Map<String,E> map, CollisionObject givenCollisionObject){
		if(getExpression().getContent(map, givenCollisionObject).getClass() == Double.class){
			if((double)getExpression().getContent(map, givenCollisionObject) != Double.POSITIVE_INFINITY){
				return  Math.sin((double)getExpression().getContent(map, givenCollisionObject));
			}
		}
		Ship ship = (Ship) givenCollisionObject;
		ship.getProgram().setMistake();
		return null;
	}
}